package com.ysd.lis.controller;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.WkKnowledgeCatalog;
import com.ysd.lis.request.KnowledgePageParam;
import com.ysd.lis.service.WkKnowledgeCatalogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 员工表
 * 前端控制器
 * </p>
 *
 * @author peng
 * @since 2024-03-12
 */
@Api(tags = "知识库目录")
@RestController
@RequestMapping("/api/wk/wkKnowledgeCatalog")
public class WkKnowledgeCatalogController extends BaseController {

    @Autowired
    WkKnowledgeCatalogService wkKnowledgeCatalogService;

    @GetMapping("/getKnowledgeCatalogTree/{knowledgeId}")
    public Result getKnowledgeCatalogTree(@PathVariable("knowledgeId") String knowledgeId) {
        return wkKnowledgeCatalogService.getKnowledgeCatalogTree(knowledgeId);
    }

    @GetMapping("/getKnowledgeCatalogAndContentTree/{knowledgeId}")
    public Result getKnowledgeCatalogAndContentTree(@PathVariable("knowledgeId") String knowledgeId) {
        return wkKnowledgeCatalogService.getKnowledgeCatalogAndContentTree(knowledgeId);
    }

    @PostMapping("/addKnowledgeCatalog")
    public Result addKnowledgeCatalog(@RequestBody WkKnowledgeCatalog catalog){
        return wkKnowledgeCatalogService.addKnowledgeCatalog(catalog);
    }

    @PostMapping("/editKnowledgeCatalog")
    public Result editKnowledgeCatalog(@RequestBody WkKnowledgeCatalog catalog){
        return wkKnowledgeCatalogService.editKnowledgeCatalog(catalog);
    }
    @PostMapping("/deletKnowledgeCatalog")
    public Result deletKnowledgeCatalog(@RequestBody WkKnowledgeCatalog catalog){
        return wkKnowledgeCatalogService.deletKnowledgeCatalog(catalog);
    }

    @ApiOperation("查询树形结构")
    @GetMapping("/findKnowledgeCatalogAndContentTree")
    public Result findKnowledgeCatalogAndContentTree(KnowledgePageParam param){
        return wkKnowledgeCatalogService.findKnowledgeCatalogAndContentTree(param);
    }
}
